
<%@ tag language="java" pageEncoding="UTF-8"
	trimDirectiveWhitespaces="true"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>


<%@ attribute name="inputId" required="true" rtexprvalue="true"
	type="java.lang.String" description=""%>

<%@ attribute name="inputName" required="true" rtexprvalue="true"
	type="java.lang.String" description=""%>

<%@ attribute name="minutes" required="true" rtexprvalue="true"
	type="java.lang.Integer" description=""%>

<%@ attribute name="readonly" required="false" rtexprvalue="true"
	type="java.lang.Boolean" description=""%>

<%
	if(minutes==null){
		minutes=0;
	}
	int iHourV = (int)(minutes / 60);
	int iMinV = minutes % 60;
%>

<c:choose>
	<c:when test="${readonly eq true }">
		<label><%=iHourV%>小时，<%=iMinV%>分钟</label>
	</c:when>
	<c:otherwise>

		<script type="text/javascript">
		
function ${inputId }_Reset(v){
	var iHourV=parseInt(v/60),iMinV=v%60;
	$("#${inputId }Hour").val(iHourV),m=$("#${inputId }Min").val(iMinV);
	$("#${inputId }").val(v);
}
function ${inputId }_OnInput(event,t){
	var h=$("#${inputId }Hour").val(),m=$("#${inputId }Min").val();
	
	var v=0;
	if(h){
		v+=parseInt(h)*60;
	}
	if(m){
		if(t==2){
			var mp=parseInt(m);
			if(mp<0||mp>59){
				$("#${inputId }Min").val("");
				return ;
			}
			v+=mp;
		}else{
			v+=parseInt(m);
		}
	}
	$("#${inputId }").val(v);
}
</script>
		<input type="hidden" id="${inputId }" name="${inputId }"
			value="${minutes }" class="number"/>
		<input type="text" id="${inputId }Hour" name="${inputId }Hour"
			oninput="${inputId }_OnInput(event,1)"
			onpropertychange="${inputId }_OnInput(event,1)" class="Number"
			class="required hide-required digits" style="width:40px;" value="<%=iHourV  %>" />小时
		<input type="text" id="${inputId }Min" name="${inputId }Min" class="number"
			oninput="${inputId }_OnInput(event,2)"
			onpropertychange="${inputId }_OnInput(event,2)"
			class="required hide-required digits" style="width:40px;" value="<%=iMinV %>" />
分钟<label class="required"></label>
</c:otherwise>
</c:choose>